Fix --output-pid (broken when we fixed --pid-file).
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 12 Aug 2005 07:21:45 +0000 (07:21 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 12 Aug 2005 07:21:45 +0000 (07:21 +0000)
Thanks to Jerone Young for spotting this.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
tools/xenstore/xenstored_core.c

index c91021876bc91ed9f72b9a1ce465f0aafa83bfd5..02f480e220b32d2da0b984bf7b4caaa836a212e4 100644 (file)
@@ -1587,7 +1587,7 @@ static struct option options[] = { { "no-fork", 0, NULL, 'N' },
 
 int main(int argc, char *argv[])
 {
-       int opt, *sock, *ro_sock, event_fd, max, tmpout;
+       int opt, *sock, *ro_sock, event_fd, max;
        struct sockaddr_un addr;
        fd_set inset, outset;
        bool dofork = true;
@@ -1673,9 +1673,8 @@ int main(int argc, char *argv[])
        restore_existing_connections();
 
        if (outputpid) {
-               char buffer[20];
-               sprintf(buffer, "%i\n", getpid());
-               write(tmpout, buffer, strlen(buffer));
+               printf("%i\n", getpid());
+               fflush(stdout);
        }
 
        /* close stdin/stdout now we're ready to accept connections */